CODING Examples



      for (var count = 0; count < 360; count++) {
      }
      moveForward(100);
      jumpBackward(100);
      penColour(colour_random());

      moveForward();
      turnLeft();
      moveForward();
      moveForward();
      turnRight();
      moveForward();
      turnRight();
      moveForward();
      moveForward();
      moveForward();
      turnLeft(); moveForward();

      moveForward(); for (var count = 0; count < 1; count++) {
      moveForward();
      }
      turnRight();
      moveForward();
      for (var count2 = 0; count2 < 1; count2++) {
      moveForward();
      }
      turnRight();
      moveForward();
      moveForward();

      moveForward();
      turnRight();
      moveForward();
      for (var count = 0; count < 2; count++) {
      moveForward();
      }
      moveForward();
      turnLeft();
      moveForward();
      for (var count2 = 0; count2 < 3; count2++) {
      moveForward();
      }
      turnLeft();
      moveForward();
      for (var count3 = 0; count3 < 3; count3++) {
      moveForward();
      }
      /*
      moveForward();
      */

      var counter;
      for (counter = 1; counter <= 300; counter++) {
      penColour(colour_random());
      moveForward(counter);
      turnRight(121);
      }

      var depth;
      var branches;
      function draw_a_tree(depth, branches) {
      if (depth > 0) {
      penColour(colour_random());
      penDown();
      moveForward(7 * depth);
      turnLeft(130);
      for (var count = 0; count < branches; count++) {
      turnRight(180 / branches);
      draw_a_tree(depth - 1, branches);
      }

      turnLeft(50);
      penUp(); moveBackward(7 * depth);
      }
      }
      draw_a_tree(9, 2);

      var counter;

      function colour_rgb(r, g, b) { r = Math.round(Math.max(Math.min(Number(r), 255), 0));
      g = Math.round(Math.max(Math.min(Number(g), 255), 0));
      b = Math.round(Math.max(Math.min(Number(b), 255), 0));
      r = ('0' + (r || 0).toString(16)).slice(-2);
      g = ('0' + (g || 0).toString(16)).slice(-2);
      b = ('0' + (b || 0).toString(16)).slice(-2);
      return '#' + r + g + b;
      }

      for (counter = 5; counter <= 200; counter += 2) {
      penColour(colour_rgb(counter, 255 - counter, 255));
      penWidth(counter);
      moveForward(5);
      turnLeft(360 / counter); }
      turnLeft(255);
      for (counter = 200; counter >= 5; counter -= 2) {
      penColour(colour_rgb(255, 255 - counter, counter));
      penWidth(counter);
      moveForward(5);
      turnRight(360 / counter);
      }

      var sides;
      var length2;
      penColour('#843179');
      sides = 4;
      length2 = 200 / sides; for (var count3 = 0; count3 < sides; count3++) {
      for (var count2 = 0; count2 < sides; count2++) {
      for (var count = 0; count < sides; count++) {
      moveForward(length2);
      turnRight(360 / sides);
      } jumpForward(length2 / 2);
      turnLeft(360 / sides);
      }
      jumpForward(length2);
      turnRight(360 / sides);
      }

      var sides;
      var length2;
      sides = 8;
      length2 = 200 / sides; for (var count3 = 0; count3 < sides; count3++) {
      for (var count2 = 0; count2 < sides; count2++) {
      for (var count = 0; count < sides; count++) {
      moveForward(length2);
      turnRight(360 / sides);
      }

      moveForward(length2);
      turnLeft(360 / sides);
      } moveForward(length2);
      turnRight(360 / sides);
      }

      function small_gear() {
      for (var count = 0; count < 6; count++) {
      moveForward(20);
      turnLeft(60);
      moveForward(10);
      turnRight(90);
      moveForward(20);
      turnRight(90);
      moveForward(10);
      turnLeft(60);
      }
      }
      function big_gear() {
      for (var count2 = 0; count2 < 12; count2++) {
      moveForward(20);
      turnLeft(75);
      moveForward(10);
      turnRight(90);
      moveForward(20);
      turnRight(90);
      moveForward(10);
      turnLeft(75);
      }
      }

      penColour('#7fffd4');
      penPattern("rainbowLine");
      penWidth(1);
      big_gear();
      small_gear();

      var counter;
      function draw_a_square_20() {
      penWidth(1);
      for (var count2 = 0; count2 < 4; count2++) {
      moveForward(20);
      turnLeft(90);
      }
      }

      for (counter = 1; counter <= 14; counter++) {
      penColour(colour_random());
      for (var count = 0; count < counter; count++) {
      draw_a_square_20();
      jumpForward(20);
      turnRight(3);
      }
      turnLeft(100);
      }